package org.apache.james.mime4j.message.storage;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public abstract class TempStorage
{
  static Class class$org$apache$james$mime4j$message$storage$TempStorage;
  private static TempStorage inst;
  private static Log log;

  static
  {
    Class localClass;
    String str;
    if (class$org$apache$james$mime4j$message$storage$TempStorage == null)
    {
      localClass = class$("org.apache.james.mime4j.message.storage.TempStorage");
      class$org$apache$james$mime4j$message$storage$TempStorage = localClass;
      log = LogFactory.getLog(localClass);
      inst = null;
      str = System.getProperty("org.apache.james.mime4j.tempStorage");
      if (str != null);
    }
    try
    {
      inst = (TempStorage)Class.forName(str).newInstance();
      if (inst == null)
        inst = new SimpleTempStorage();
      return;
      localClass = class$org$apache$james$mime4j$message$storage$TempStorage;
    }
    catch (Throwable localThrowable)
    {
      while (true)
        log.warn("Unable to create or instantiate TempStorage class '" + str + "' using SimpleTempStorage instead", localThrowable);
    }
  }

  static Class class$(String paramString)
  {
    Class localClass;
    try
    {
      localClass = Class.forName(paramString);
      return localClass;
    }
    catch (ClassNotFoundException localClassNotFoundException)
    {
      throw new NoClassDefFoundError().initCause(localClassNotFoundException);
    }
  }

  public static TempStorage getInstance()
  {
    return inst;
  }

  public static void setInstance(TempStorage paramTempStorage)
  {
    if (paramTempStorage == null)
      throw new NullPointerException("inst");
    inst = paramTempStorage;
  }

  public abstract TempPath getRootTempPath();
}